package org.example.struct.array;

import java.util.Arrays;

/**
 * @author liyishan
 * @date 2023/12/27 09:10
 * @apiNote
 */

public class Test00976LargestPerimeter {

    public static int largestPerimeter(int[] nums) {
        Arrays.sort(nums);
        for (int i = nums.length - 1; i >= 2; i--) {
            if(nums[i-2] + nums[i-1] > nums[i]){
                return nums[i-2] + nums[i-1] + nums[i];
            }
        }
        return 0;
    }
}
